<?php
/**
 * Created by PhpStorm.
 * User: yuanjie
 * Date: 2017/3/23
 * Time: 下午1:36
 */
use EasyWeChat\Foundation\Application;
class WechatUserController extends BaseController
{
    private $user;
    public function __construct()
    {
        $wx = Config::get('wechat.CHEPIN');
        $options = $wx['OPTION'];
        $app = new Application($options);
        $this->user = $app->user;
    }

    //获取关注用户列表
    public function lists(){
        $list = $this->user->lists()->toArray();
        return json_encode($list);
    }

    //获取单个用户的详细信息
    public function get(){
        // opGRwv97mWKfn9OpT2TR1OqbE5bE famous
        // opGRwv0x1OV9PP4gcNTq66rzkBWE husheng
        $data = $this->user->get('opGRwv97mWKfn9OpT2TR1OqbE5bE')->toArray();
        return json_encode($data);
    }
}